#include <a_master>

#tryinclude num_players

#include <myfuncs>
#define FORW_DIST 2.0
#include <myenter>

new Float:epoint[8][NUM_PLAYERS];
new eint[2][NUM_PLAYERS];

public OnPlayerCommandText(playerid, cmdtext[])
{
	if(strcmd(cmdtext, "/esave1"))
	{
		new msg[128];
		GetPlayerPosition(playerid, epoint[0][playerid], epoint[1][playerid], epoint[2][playerid], epoint[3][playerid]);
		eint[0][playerid] = GetPlayerInterior(playerid);
		if(epoint[4][playerid] != 0.0 && epoint[5][playerid] != 0.0)
		{
			format(msg, sizeof(msg), "%0.2f, %0.2f, %0.3f, %0.2f, %0.2f, %0.2f, %0.3f, %0.2f, %d, %d, %d;",
				epoint[0][playerid], epoint[1][playerid], epoint[2][playerid], epoint[3][playerid],
				epoint[4][playerid], epoint[5][playerid], epoint[6][playerid], epoint[7][playerid],
				eint[0][playerid], eint[1][playerid], GetPlayerVirtualWorld(playerid));

			WriteLog("enters.dat", msg, false);
			SendClientMessage(playerid, COLOR_INFO3, msg);

			AddEntrace(epoint[0][playerid], epoint[1][playerid], epoint[2][playerid], epoint[3][playerid],
				epoint[4][playerid], epoint[5][playerid], epoint[6][playerid], epoint[7][playerid],
				eint[0][playerid], eint[1][playerid], GetPlayerVirtualWorld(playerid));

			for(new i=0; i < 8; i++)
				epoint[i][playerid] = 0.0;
		}
		return 1;
	}
	else if(strcmd(cmdtext, "/esave2"))
	{
		new msg[128];
		GetPlayerPosition(playerid, epoint[4][playerid], epoint[5][playerid], epoint[6][playerid], epoint[7][playerid]);
		eint[1][playerid] = GetPlayerInterior(playerid);
		if(epoint[0][playerid] != 0.0 && epoint[1][playerid] != 0.0)
		{
			format(msg, sizeof(msg), "%0.2f, %0.2f, %0.3f, %0.2f, %0.2f, %0.2f, %0.3f, %0.2f, %d, %d, %d;",
				epoint[0][playerid], epoint[1][playerid], epoint[2][playerid], epoint[3][playerid],
				epoint[4][playerid], epoint[5][playerid], epoint[6][playerid], epoint[7][playerid],
				eint[0][playerid], eint[1][playerid], GetPlayerVirtualWorld(playerid));
			WriteLog("enters.dat", msg, false);
			SendClientMessage(playerid, COLOR_INFO3, msg);

			AddEntrace(epoint[0][playerid], epoint[1][playerid], epoint[2][playerid], epoint[3][playerid],
				epoint[4][playerid], epoint[5][playerid], epoint[6][playerid], epoint[7][playerid],
				eint[0][playerid], eint[1][playerid], GetPlayerVirtualWorld(playerid));

			for(new i=0; i < 8; i++)
				epoint[i][playerid] = 0.0;
		}
		return 1;
	}
	return 0;
}


public OnPlayerPickUpPickup(playerid, pickupid)
{
	return !ent_ParsePickUp(playerid, pickupid);
}

public OnFilterScriptExit()
{
	while(PopEntrace())
		continue;
	return 1;
}
